﻿#region License
/*

	Copyright (C) 2008 Oliver Charles, Daniel Hollander

	This program is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program.  If not, see <http://www.gnu.org/licenses/>.
	
*/
#endregion

using System.Drawing;
using Moebius.Rendering;

namespace Moebius.Components
{
    /// <summary>
    /// An <see cref="Image"/> is a plane in the world that uses a specific image atlus. Quads can then be added to this plane to create instances of images, from the 
    /// images <see cref="mImageAtlus"/>.
    /// </summary>
    public abstract class Image : BaseComponent
    {
        #region Properties

        private ImageAtlas mImageAtlus;
        private float mLayer;

        /// <summary>
        /// Gets or sets the image atlus of this image
        /// </summary>
        public ImageAtlas ImageAtlas
        {
            get { return mImageAtlus; }
            set { mImageAtlus = value; }
        }

        /// <summary>
        /// Gets the layer of this plane.
        /// </summary>
        public float Layer
        {
            get { return mLayer; }
        }

        #endregion

        #region Add Quad

        /// <summary>
        /// Add a quad to this image.
        /// </summary>
        /// <param name="rectangle">The region of the quad, in screen space.</param>
        /// <param name="imageIdentifier">The identifier of the image that this quad should have, from the image atlus.</param>
        public abstract void AddQuad(RectangleF rectangle, string imageIdentifier);

        #endregion
        #region Initialize

        /// <summary>
        /// Initialize this image.
        /// </summary>
        /// <param name="initialQuadCount">The initial amount of quads that this image can hold. For performance reasons, it is best to be as accurate as you can here.</param>
        /// <param name="layer">The layer that this plane lies on.</param>
        public virtual void Initialize(int initialQuadCount, float layer)
        {
            mLayer = layer;
        }

        #endregion
    }
}